<?php

/**
 * This file is part of the Codizer package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @copyright   Copyright (c) 2010 Advisa (http://www.advisa.fr)
 * @author      Codizer Core Team <team@codizer.org>
 * @package     Codizer
 */

class f_relation_RelationQueryBuilder extends f_database_AbstractQueryBuilder
{	
	/**
	 * @return class f_relation_RelationQueryBuilder

	 */
	private function __construct()
	{
        $this->tableName = 'f_relation';
		return $this;
	}
	
	/**
	 * Get singleton instance
	 *
	 * @return f_relation_RelationQueryBuilder
	 */
	public static function getInstance()
	{
		return new self();
	}

    public function setParent($parent)
    {
        $this->addEqualCondition('parent_id', $parent->getUniqueId());
        $this->addEqualCondition('parent_model', $parent->getModel());
        return $this;
    }

    public function setChild($child)
    {
        $this->addEqualCondition('child_id', $child->getUniqueId());
        $this->addEqualCondition('child_model', $child->getModel());
        return $this;
    }
}